<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%--
修改公告板信息页面
--%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>EShopManager</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/lib/bootstrap/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/stylesheets/theme.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/lib/font-awesome/css/font-awesome.css"/>
    <script src="${pageContext.request.contextPath}/static/lib/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/lib/ckeditor/ckeditor.js" type="text/javascript"></script>

    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height: 300px;
            width: 800px;
            margin: 0px auto;
            margin-top: 1em;
        }

        .brand {
            font-family: georgia, serif;
        }

        .brand .first {
            color: #ccc;
            font-style: italic;
        }

        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>

</head>
<body>

<%--  顶部页面 --%>
<c:import url="top.jsp"></c:import>


<%-- 左部页面 --%>
<%-- 引入left.jsp时，同样可以传递请求参数 --%>
<c:import url="left.jsp"></c:import>


<div class="content">
    <div class="header">
        <h1 class="page-title">促销管理</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="bookmanager.jsp">促销管理</a> <span class="divider">/</span></li>
        <li class="active">公告板</li>
    </ul>


    <div class="container-fluid">

        <div class="row-fluid">

            <div class="btn-toolbar">
                <button class="btn btn-primary" id="btnSave">
                    <i class="icon-save"></i> 保存
                </button>
                <button class="btn btn-primary" id="aaa">
                    返回
                </button>
            </div>
            <div class="well">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#basicInfo" data-toggle="tab">通用信息</a></li>
                </ul>

                <!-- 通用信息 -->
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="basicInfo">
                        <form id="uploadForm" enctype="multipart/form-data">
                            <label>可链接的图书ID</label>
                            <input type="text" value="${newsInfo.bookId}" name="book_id" class="input-xlarge">

                            <label>公告内容</label>
                            <input type="text" value="${newsInfo.newsTitle}" name="news_title" class="input-xlarge">
                        </form>
                    </div>

                </div>

            </div>

        </div>

        <%--   底部页面     --%>
        <c:import url="footer.jsp"></c:import>

    </div>

</div>


<script src="${pageContext.request.contextPath}/static/lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/tooltips.js"></script>

<script>
    $("#btnSave").click(function () {
        var book_id = $("input[name='book_id']").val();
        var news_title = $("input[name='news_title']").val();
        if (book_id == '') {
            show_err_msg("请输入书籍ID");
        } else if (news_title == '') {
            show_err_msg("请输入公告内容");
        } else {

            show_loading();

            var url = "${pageContext.request.contextPath}/ad/updateNew";
            var data = {
                news_id:${news_id},
                book_id: book_id,
                news_title: news_title
            };
            $.post(url, data, function (response) {
                if (response.msg) {
                    show_msg("修改成功", "${pageContext.request.contextPath }/ad/adnews");
                } else {
                    show_err_msg('修改失败');
                }

            });

        }

        return false;
    });

    $("#aaa").click(function () {
        location.href = "${pageContext.request.contextPath }/ad/adnews";
    });
</script>

</body>
</html>
